package io.renren.modules.member.controller;

import java.util.Arrays;
import java.util.Map;

import io.renren.common.annotation.NoRepeatSubmit;
import io.renren.modules.member.entity.TStoreMemberAccountDetailEntity;
import io.renren.modules.member.service.TStoreMemberAccountDetailService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 
 *
 * @author steakliu
 * @email 2319492349@qq.com
 * @date 2021-01-26 22:36:09
 */
@RestController
@RequestMapping("store/tstorememberaccountdetail")
public class TStoreMemberAccountDetailController {
    @Autowired
    private TStoreMemberAccountDetailService tStoreMemberAccountDetailService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("store:tstorememberaccountdetail:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = tStoreMemberAccountDetailService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{memberId}")
    @RequiresPermissions("store:tstorememberaccountdetail:info")
    public R info(@PathVariable("memberId") Long memberId){
		TStoreMemberAccountDetailEntity tStoreMemberAccountDetail = tStoreMemberAccountDetailService.getById(memberId);

        return R.ok().put("tStoreMemberAccountDetail", tStoreMemberAccountDetail);
    }

    /**
     * 保存
     */
    @NoRepeatSubmit
    @RequestMapping("/save")
    @RequiresPermissions("store:tstorememberaccountdetail:save")
    public R save(@RequestBody TStoreMemberAccountDetailEntity tStoreMemberAccountDetail){
		tStoreMemberAccountDetailService.save(tStoreMemberAccountDetail);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("store:tstorememberaccountdetail:update")
    public R update(@RequestBody TStoreMemberAccountDetailEntity tStoreMemberAccountDetail){
		tStoreMemberAccountDetailService.updateById(tStoreMemberAccountDetail);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("store:tstorememberaccountdetail:delete")
    public R delete(@RequestBody Long[] memberIds){
		tStoreMemberAccountDetailService.removeByIds(Arrays.asList(memberIds));

        return R.ok();
    }

}
